#!/bin/sh 
# 
# ~/.xinitrc 
# 
# Executed by startx (run your window manager from here) 
# 
#export XMODIFIERS="@im=sicm"
#export GTK_IM_MODULE=scim
#export QT_IM_MODULE=scim
#----------------------------
#   export LANG=zh_CN.utf8
#   export LC_CTYPE=zh_CN.utf8
#   export LANGUAGE=zh_CN.utf8
#   export LC_TIME=zh_CN.utf8
#----------------------------

#----------------------------
#----------------------------
export LANGUAGE="zh_CN:zh:en_US:en"
export LC_CTYPE="zh_CN.UTF-8"
export LANG="zh_CN.UTF-8"
export LC_TIME="zh_CN.UTF-8"
#----------------------------


#----------------------------
export XIM=scim
export XMODIFIERS="@im=scim"
export GTK_IM_MODULE=scim
export QT_IM_MODULE=scim
export XIM_PROGRAM=/usr/bin/scim
export XIM_ARGS="-d"
#----------------------------
#scim -f socket -c socket -d
#----------------------------
killall urxvtd
killall fcitx
#----------------------------
#scim -d
#exec rox -p Default &
#exec /usr/bin/fvwm-crystal
#exec gnome-session
#exec xfce4-session
#exec /usr/bin/fvwm
#exec /usr/bin/openbox
#exec /usr/bin/fluxbox
#exec /usr/bin/fvwm-themes-start

#-----------------------------------------------------------
session_default=fvwm-crystal

# Allow session to be set from startx (startx ~/.xinitrc wmii) 
session=$3 
test -z "$session" && session=$session_default 
# Start URxvt daemon so we can quickly open the other clients 
#urxvtd -q -o -f & [[ -x "/usr/bin/numlockx" ]] && numlockx & 

# Set Wallpaper with feh 
#eval `cat ~/.fehbg` & 

case "$session" in 

    "compiz") 
        if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then 
            eval `dbus-launch --sh-syntax --exit-with-session` 
        fi 
        exec /usr/bin/lxsession -s Compiz;; 


    "dwm") 
        trayer --SetDockType false --edge top --widthtype request --align right --height 10 &  
        while [ 1 ]; do 
            # Get amount of unread messages if gajim is running 
            test -n "`pidof gajim`" && msgs=`gajim-remote get_unread_msgs_number` 
            test -z "$msgs" && msgs=0 echo -n "IM: $msgs | `date '+%H:%M %a, %b %Y'` " 
            sleep 60; 
        done | exec dwm;; 
            
    "wmii") 
        exec wmii;; 
           
    "openbox") 
        xcompmgr -n &  
        avant-window-navigator &  
        exec openbox;; 
            
    "subtle") 
        urxvt &  
        (test `pidof xbindkeys` || xbindkeys) &  
        echo -e "\n=== Starting subtle on `date '+%Y-%m-%d %H:%M'` ===" >> 
        .subtle/subtle.log exec subtle -D >> .subtle/subtle.log 2>&1;; *) 
        exec urxvt;; 


    "fvwm") 
        #exec urxvtd &
        #exec rox -p Default &
        exec /usr/bin/fvwm;;

    "fvwm-crystal") 
        exec urxvtd &
        #exec rox -p Default &
        exec /usr/bin/fvwm-crystal;;

esac
